package com.huawei;

/**
 * Created by Z-hong on 2024/7/24.
 */

import java.util.*;

public class HJ75 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str_1 = sc.nextLine();
        String str_2 = sc.nextLine();
        int arr[][]=new int[str_1.length()+1][str_2.length()+1];
        int max=0;

        for (int i = 1; i <= str_1.length(); i++) {
            for (int j = 1; j <= str_2.length(); j++) {
                if(str_1.charAt(i-1)==str_2.charAt(j-1)){
                    arr[i][j]=arr[i-1][j-1]+1;
                    max=Math.max(max,arr[i][j]);
                }else{
                    arr[i][j]=0;
                }
            }
        }

        System.out.println(max);
    }
}
